package simple.utils.concurrent;

import java.util.concurrent.LinkedBlockingQueue;

/**
 * Created with IntelliJ IDEA.
 * User: rehak
 * Date: 5/3/13
 * Time: 11:40 AM
 * To change this template use File | Settings | File Templates.
 */
public class AlwaysBlockingQueue<E> extends LinkedBlockingQueue<E> {

    public AlwaysBlockingQueue(int limit) {
        super(limit);
    }

    @Override
    public boolean offer(E o) {
        try {
            put(o);
            return true;
        } catch (InterruptedException ie) {
            Thread.currentThread().interrupt();
        }
        return false;
    }

    public boolean isFull() {
        return super.remainingCapacity() == 0;
    }
}
